#include<bits/stdc++.h>
using namespace std;

int w[100005], c[100005], vis[100005];

int main() {
	int m, n;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> w[i];
	}
	for (int i = 1; i <= m; i++) {
		cin >> c[i];
	}

	int ans = 0, idx = m;
	sort(c + 1, c + m + 1);
	sort(w + 1, w + n + 1);
	for (int i = n; i >= 1; i--) {
		if (idx < 2)
			break;
		idx = upper_bound(c + 1, c + idx + 1, w[i]) - c;
		for (; idx > 1; idx--) {
			if (!vis[idx - 1]) {
				vis[idx - 1] = 1;
				ans++;
				break;
			}
		}
	}
	cout << ans;
	return 0;
}
